package com.yes.xr.jdbc;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;

public class JdbcUpdate {
    public static void main(String[] args) throws Exception {
        Class.forName("com.mysql.jdbc.Driver");
        String url="jdbc:mysql://localhost:3306/text1?useSSL=false";
        String username="root";
        String password="985211";
        Connection connection = DriverManager.getConnection(url,username,password);
        Statement statement = connection.createStatement();

        String sql="UPDATE`user` SET id=3 WHERE username='tom'";
        int i = statement.executeUpdate(sql);
        if (i>0) {
            System.out.println("更改成功！");
        }
    }
}
